package com.guang.testspringmybatis.service;

import com.guang.testspringmybatis.mapper.ReviewContentMapper;
import com.guang.testspringmybatis.pojo.ReviewContent;
import com.guang.testspringmybatis.pojo.ReviewContentExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.List;

/**
 * @author liguang
 * @date 2022/8/24 14:54
 */
@Service
public class ReviewService {

    @Autowired
    private ReviewContentMapper reviewContentMapper;


    public void test(){
        ReviewContentExample example= new ReviewContentExample();
        ReviewContentExample.Criteria criteria = example.createCriteria();
        criteria.andIdEqualTo(1);
        List<ReviewContent> reviewContents = reviewContentMapper.selectByExample(example);
        ReviewContent reviewContent = CollectionUtils.firstElement(reviewContents);
        System.out.println("---------------------------"+reviewContent);
    }

}
